#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :2.0.7 进程实验.py
# @Time      :2020/7/14 13:22
# @Author    :亮亮
# @说明       :进程讲解demo
# @总结       :
from threading import Thread
import time
import multiprocessing


def name1():
    while True:
        print("----1----")
        time.sleep(1)


def name2():
    while True:
        print("----2----")
        time.sleep(1)


def main():
    # 创建线程
    # t1 = Thread(target=name1)
    # t2 = Thread(target=name2)

    # 创建进程
    p1 = multiprocessing.Process(target=name1)
    p2 = multiprocessing.Process(target=name2)

    # 运行线程
    p1.start()
    p2.start()


if __name__ == '__main__':
    main()
